#include <iostream>
#include <cstdlib>
using namespace std;

int main()
{
	int n;
	double sum = 0.0;
	cin >> n;
	int* arr = (int *)malloc(sizeof(int) * n);
	for(int i = 0;i<n;i++)
	{
		cin >> arr[i];
	}
	
	int max = arr[0];
	int min = arr[0];
	int max_rec = 0;
	int min_rec = 0;
	for(int i = 0;i<n;i++)
	{
		if(arr[i] > max)
		{
			max = arr[i];
			max_rec = i;
		}
	}

	for(int i = 0;i<n;i++)
	{
		if(arr[i] < min)
		{
			min = arr[i];
			min_rec = i;
		}	
	}	
	
	arr[max_rec] = 0;
	arr[min_rec] = 0;
	for(int i = 0;i<n;i++)
	{
		sum = sum + arr[i];
	}
	
	sum = sum / (n-2);
	
	printf("%.2lf",sum);
	
	return 0;
}
